// pages/myCenter/msgcenter/msgcenter.js
let app = getApp();
let httptool=require("../../../utils/zry.httptool.js");
let util=require("../../../utils/util.js");
Page({
  data:{
      customerId:'',
      msgData:[],
      msgprop:'',//消息提示 
      noData: false,
  },
  /**/
  detailMsg:function(e){
    let that=this;
    let id = e.currentTarget.dataset.id;
    let name=e.currentTarget.dataset.name;
    wx.navigateTo({
      url: '../detailmsg/detailmsg?UserId=' + that.data.customerId + "&ID=" + id+"&Name="+name,
    })
  },
  onLoad: function(options){
      
  },
  onShow: function(){
    let that = this;
    let customerId = app.getStorage('customerId');
    that.setData({ customerId: customerId });
    httptool.ajaxPost("api/Message/GetMessage", { UserId: customerId }, function (res) {
      if (res.suc) {
        let data = app.notNull(res.data, []);
        that.setData({ msgData: data, noData: data.length==0 });
      } else {
        app.showNotify(that, res.msg);
      }
    });
  }
})